package com.CuandoLlegaAndroid.Custom;


import com.CuandoLlegaAndroid.R;
import com.CuandoLlegaAndroid.R.id;
import com.CuandoLlegaAndroid.R.layout;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

public class CustomToast {

	private Context context;

	/**
	 * Public constructor form Custom Toast
	 * @param t
	 */
	public CustomToast(Context t) 
	{
		this.context = t;
	}


	/**
	 * Show custom Toast
	 * @param message
	 */
	public void ShowToast(String message) 
	{
		//get the LayoutInflater and inflate the custom_toast layout
		LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View layout = inflater.inflate(R.layout.toast, null);

		//get the TextView from the custom_toast layout
		TextView text = (TextView) layout.findViewById(R.id.toastText);
		text.setText(message);

		//create the toast object, set display duration,
		//set the view as layout that's inflated above and then call show()
		Toast t = new Toast(context.getApplicationContext());
		t.setDuration(Toast.LENGTH_LONG);
		t.setView(layout);

		t.show();
	}

}
